import axios from "axios"


let http = axios.create({
   
})

//请求拦截器
http.interceptors.request.use((req)=>{
    if(sessionStorage.getItem("userInfo")){
        req.headers.authorization = sessionStorage.getItem("userInfo")?JSON.parse(sessionStorage.getItem("userInfo")).token:"";
    }
     return req
});

//响应拦截器
http.interceptors.response.use((res)=>{

    //可以对响应的数据进行处理
    return res.data
})
export default http